<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-score-add">
			<div class="form-group">
				<label class="col-sm-3 control-label">录入学生：</label>
				<div class="col-sm-8">
					<select id="stuNum" name="stuNum" class="form-control select2-hidden-accessible" multiple="">
						<option th:each="student:${students}" th:value="${student.stuNum}" th:text="${student.stuName}" th:disabled="${student.status == '1'}"></option>
					</select>

				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">学期：</label>
				<div class="col-sm-8">
					<select id="termNum" name="termNum" class="form-control select2-hidden-accessible" multiple="">
						<option th:each="term:${terms}" th:value="${term.termNum}" th:text="${term.termName}"}></option>
					</select>
				</div>
			</div>
			<!--<div class="form-group">-->
				<!--<label class="col-sm-3 control-label">班级号：</label>-->
				<!--<div class="col-sm-8">-->
						<!--<select id="classNo" name="classNo" class="form-control select2-hidden-accessible" multiple="">-->
							<!--<option th:each="class:${classes}" th:value="${class.classNo}" th:text="${class.className}"}></option>-->
						<!--</select>-->
				<!--</div>-->
			<!--</div>-->
			<div class="form-group">
				<label class="col-sm-3 control-label">语文成绩：</label>
				<div class="col-sm-8">
					<input id="scoreChinese" name="scoreChinese" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">数学成绩：</label>
				<div class="col-sm-8">
					<input id="scoreMath" name="scoreMath" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">英语成绩：</label>
				<div class="col-sm-8">
					<input id="scoreEnglish" name="scoreEnglish" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">政治成绩：</label>
				<div class="col-sm-8">
					<input id="scorePolitical" name="scorePolitical" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">历史成绩：</label>
				<div class="col-sm-8">
					<input id="scoreHistory" name="scoreHistory" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">生物成绩：</label>
				<div class="col-sm-8">
					<input id="scoreBiology" name="scoreBiology" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">地理成绩：</label>
				<div class="col-sm-8">
					<input id="scoreGeographical" name="scoreGeographical" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">化学成绩：</label>
				<div class="col-sm-8">
					<input id="scoreChemistry" name="scoreChemistry" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">物理成绩：</label>
				<div class="col-sm-8">
					<input id="scorePhysical" name="scorePhysical" class="form-control" type="text">
				</div>
			</div>

		</form>
	</div>
    <div th:include="include::footer"></div>
	<script th:src="@{/ajax/libs/select/select2.js}"></script>
    <script type="text/javascript">
		var prefix = ctx + "system/score"
		$("#form-score-add").validate({
			rules:{
                stuNum:{
					required:true,
				},
				termNum:{
                    required:true,
                },
                classNo:{
                    required:true,
                }

			}
		});
		
		function submitHandler() {
           add();
	    }
        function add() {
            var stuNum = $("#stuNum option:selected").val();
            var stuName=$("#stuNum option:selected").text();
			var termNum= $("#termNum option:selected").val();
            // var classNo=$("#classNo option:selected").val();
            var scoreChinese = $("input[name='scoreChinese']").val();
            var scoreMath = $("input[name='scoreMath']").val();
            var scoreEnglish = $("input[name='scoreEnglish']").val();
            var scorePolitical = $("input[name='scorePolitical']").val();
            var scoreHistory = $("input[name='scoreHistory']").val();
            var scoreBiology = $("input[name='scoreBiology']").val();
            var scoreGeographical = $("input[name='scoreGeographical']").val();
            var scoreChemistry = $("input[name='scoreChemistry']").val();
            var scorePhysical = $("input[name='scorePhysical']").val();
            $.ajax({
                cache : true,
                type : "POST",
                url : prefix + "/add",
                data : {
                    "stuNum": stuNum,
                    "stuName": stuName,
                    "termNum": termNum,
                    "scoreChinese": scoreChinese,
                    "scoreMath": scoreMath,
                    "scoreEnglish": scoreEnglish,
                    "scorePolitical": scorePolitical,
                    "scoreBiology": scoreBiology,
                    "scoreGeographical": scoreGeographical,
                    "scoreChemistry": scoreChemistry,
                    "scorePhysical": scorePhysical,
                    "scoreHistory": scoreHistory
                },
                async : false,
                error : function(request) {
                    $.modal.alertError("系统错误");
                },
                success : function(data) {
                    $.operate.successCallback(data);
                }
            });
        }
	</script>
</body>
</html>
